/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package BL;

import BO.OrdenDeViaticos;
import DA.DAOrden;
import java.sql.Connection;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author David
 */
public class BLOrden {
    
        public static  void insertarOrdenDeViaticos(OrdenDeViaticos orden) throws SQLException, ClassNotFoundException, ParseException{
        
          DAOrden in= new DAOrden();
          in.InsertarOrdenDeViaticos(orden);
        
    }
    
    public static boolean existeOrden(int Numero) throws SQLException, ClassNotFoundException
    {
        DAOrden in= new DAOrden();
        return in.existeOrden(Numero);
    }

    public static OrdenDeViaticos buscarOrden(int Numero) throws SQLException, ClassNotFoundException
    {
        DAOrden in= new DAOrden();
        return in.buscarOrden(Numero);
    }
    
     public static void AnularViatico( int numOrden) throws SQLException, ClassNotFoundException
    {
         DAOrden an= new DAOrden();
         an.anularViatico(numOrden);
    }
    


    public static int ObtenerConsecutivo(){
        int valor=0;
            try {
                DAOrden in = new DAOrden();
                valor=in.Obtener_Consecutivo()+1;
            } catch (SQLException ex) {
                Logger.getLogger(BLOrden.class.getName()).log(Level.SEVERE, null, ex);
            }
            return valor;
    }

        public static Connection obtenerConexion() throws ClassNotFoundException
    {
        DAOrden in= new DAOrden();
        return in.obtenerConexion();
    }


}
